require 'crawler/facebook_crawler'

conditions = nil
conditions = ARGV[0] unless ARGV[0].nil?

crawler = Crawler::FacebookCrawler.new({
  :conditions => conditions,
  :stop_crawling? => lambda {|c| c.status == 403}
})

p crawler

begin
  log = crawler.start_crawling {|c| p c}
  
  if log[:stopped] then
    delay = 50 * 60
    p "Slepping #{delay}"
    sleep delay
  end
end while (log[:stopped])

puts "Finis"
puts log